package model.utils;

import model.Point;

public class Utils
{
    private Utils(){};

    public static Point calcMidPoint(Point start, Point end)
    {
        double midPointX = start.getX() + ( end.getX() - start.getX() ) / 2;
        double midPointY = start.getY() + ( end.getY() - start.getY() ) / 2;

        return new Point(midPointX , midPointY);
    }

    public static double calcDistance(Point start,Point end)
    {
        //sqrt( (x1-x2)^2 + (y1-y2)^2 ) / 2
        return Math.sqrt(
                          Math.pow(Math.abs( end.getX() - start.getX() ),2) +
                          Math.pow(Math.abs( end.getY() - start.getY() ),2)
                        );
    }
}
